/**
 * @FilePath     : /src/lgmg_robots/agv_navigation/agv_navigate/include/agvWorld/pso_method.h
 * @Description  : 粒子群优化方法的类定义，包含构造函数、配置、计算和获取最佳结果的方法。 
 * @Author       : xiujun.yang
 * @Version      : 1.0.0
 * @LastEditors  : haibo haibo.yang@lgmgim.cn
 * @LastEditTime : 2024-12-19 15:37:23
 * @Copyright (c) 2024 by 临工智能信息科技有限公司, All Rights Reserved. 
**/

#pragma once
#include "pso.h"
typedef void (*ObjectiveFunction)(Particle*);

///////////////////////////////////////////////////////////////////////////////
class PSOMethod {
 public:
	// Constructors
	PSOMethod();
	PSOMethod(int num_particles, int num_iterations, double* lower_bounds, double* upper_bounds,
		double* vmax, ObjectiveFunction objective_function, double c1, double c2,
		int seed, double inertia_weight, double constriction_factor, double max_velocity,
		const std::string& log_file, const std::string& result_file);
	~PSOMethod();
	// Configuration
	void Configure(int identifier, const double* pos, const double* vel);
	void Clear();
	int Compute();
	void PrintBest() const;
	double GetBestValue() const;
	const double* GetBestPosition() const;
	bool GetBestFeasibility() const;

 private:
	PSO* pso_;
};
